import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const routes = [
  {
    path: '/',
    redirect: "/loginTo",
  },
  {
    path: "/loginTo",
    name: "Login",
    component: () => import('@/views/login')
  },
  {
    path: "/layout",
    component: () => import('@/layout'),
    children: [
      {
        path: '/layout',
        redirect: '/layout/home'
      },
      {
        path: '/layout/home',
        name: "home",
        component: () => import('@/views/home')
      },
      {
        path: '/layout/class',
        name: "class",
        component: () => import('@/views/class')
      },
      {
        path: '/layout/cart',
        name: "cart",
        component: () => import('@/views/cart')
      },
      {
        path: '/layout/my',
        name: "my",
        component: () => import('@/views/my')
      },
      {
        path: "/layout/seckill",
        name: 'seckill',
        component: () => import('@/views/seckill')
      },
      {
        path: "/layout/detail",
        name: 'detail',
        component: () => import('@/views/detail')
      }
    ]
  }
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes
});

export default router;
